#define _CRT_SECURE_NO_WARNINGS
#include <cstring>
#include<stdio.h>
#include<iostream>
#include<stdbool.h>
using namespace std;

class String
{
	char arr[10];
public:
	String(char* p)
	{
		strcpy(arr, p);
	}
	char* getchar()
	{
		return arr;
	}
	

};
 char* operator>(String& m1, String& m2)
{
	 char p1[20] = { 0 };
	 char p2[20] = { 0 };
	 strcpy(p1, m1.getchar());
	 strcpy(p2, m2.getchar());
	 int i = 0;
	 while (p1[i])
	 {
		 if (isupper(p1[i]))
			 p1[i] = tolower(p1[i]);
		 i++;
	 }
	 i = 0;
	 while (p2[i])
	 {
		 if (isupper(p2[i]))
			 p2[i] = tolower(p2[i]);
		 i++;
	 }
	 i = 0;
	 while (p1[i])
	 {
		 if (p1[i] > p2[i])
			 return m2.getchar();
		 if (p1[i] < p2[i])
			 return m1.getchar();
		 i++;
	 }
}
template<typename p>
p Min(p x, p y)
{
	if (x > y)
		return y;
	else
		return x;
}
ostream& operator<<(ostream& out, String p)
{
	cout << p.getchar();
	return out;
}
char* Min(char* m1, char* m2)
{
	char p1[20] = { 0 };
	char p2[20] = { 0 };
	strcpy(p1, m1);
	strcpy(p2, m2);
	int i = 0;
	while (p1[i])
	{
		if (isupper(p1[i]))
			p1[i] = tolower(p1[i]);
		i++;
	}
	i = 0;
	while (p2[i])
	{
		if (isupper(p2[i]))
			p2[i] = tolower(p2[i]);
		i++;
	}
	i = 0;
	while (p1[i])
	{
		if (p1[i] > p2[i])
			return m2;
		if (p1[i] < p2[i])
			return m1;
		i++;
	}
}
int main()
{
	int x, y;
	double a, b;
	char c1[20], c2[20], c3[20], c4[20];
	cin >> x >> y;
	cout << Min(x, y) << endl;
	cin >> a >> b;
	cout << Min(a, b) << endl;
	cin >> c1 >> c2;
	cout << Min(c1, c2) << endl;
	cin >> c3 >> c4;
	String s1(c3), s2(c4);
	//cout << Min(s1, s2);
	cout << "Jack";
	return 0;
}